module busint(input iocs, iorw,
	      input rda, tbr, input [7:0] recbuf, 
		 input [1:0] ioaddr,
	      output [7:0] out, 
	      inout [7:0] databus);
   
   wire [7:0] 		  dataout;
   
   assign 		  databus = (iocs & iorw) ? dataout : 8'bZ;
   assign 		  out = (iocs & ~iorw) ? databus : 8'd0;
   assign 		  dataout = (ioaddr == 2'b00) ? recbuf : {6'd0, tbr, rda};

endmodule
